import com.pink.*;
import org.junit.Assert;
import org.junit.Test;

import java.awt.*;
import java.io.FileNotFoundException;
import java.util.concurrent.TimeUnit;

public class sim {

////        吴江列传颜色
//        [r=200,g=179,b=121]
////        主界面夜色
//        [r=73,g=18,b=16]
////        逐鹿天下颜色
//        [r=220,g=200,b=140]
//          欢乐成双竞技
//        [r=236,g=215,b=148]


    @Test
    public void test01() throws AWTException, InterruptedException {
        Robot robot = new Robot();
        for (int i = 0; i < 20; i++) {
            TimeUnit.SECONDS.sleep(2);
//            menu core point
//            Color pixelColor = robot.getPixelColor(201, 656);
            Color pixelColor = robot.getPixelColor(910, 729);
            System.out.println(pixelColor);
        }

    }

    @Test
    public void test02() throws AWTException {
        RobotEx robotEx = new RobotEx();
        TinyEggPrinter tinyEggPrinter = new TinyEggPrinter(robotEx);
        try {
            TimeUnit.SECONDS.sleep(4);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        for (int i = 0; i < 100; i++) {
            boolean b = tinyEggPrinter.eggUpdate();
            if (!b) {
                System.out.println("完成了" + i + "个");
                break;
            }
        }
    }

    @Test
    public void test03() throws AWTException, InterruptedException, FileNotFoundException {
        InputTaskOutputLog io = new Analysis();
        RobotEx robotEx = new RobotEx();
        WoodWorker woodWorker = new WoodWorker(robotEx, io);
        TimeUnit.SECONDS.sleep(5);
//         woodWorker.tagAbout("xieweig111");
        // todo to test
//         woodWorker.getReward("weiwu0076");
//         woodWorker.dailySign("xieweig222");
        woodWorker.sprintTask();

    }

    @Test
    public void test04() throws FileNotFoundException, AWTException, InterruptedException {
        InputTaskOutputLog io = new Analysis();
        RobotEx robotEx = new RobotEx();
        WoodWorker woodWorker = new WoodWorker(robotEx, io);
        TimeUnit.SECONDS.sleep(3);
//          boolean b = woodWorker.closeInvitation();
//          boolean b = woodWorker.openInvitation();
//          Assert.assertEquals(true,b);
//          Assert.assertEquals(true,b1);
    }

    //            四级任务绿色　r=93,g=162,b=90
//            三级任务紫色  r=69,g=30,b=78 r=71,g=34,b=81
//            二级任务黄色　r=217,g=148,b=13
//            一级任务红色　r=212,g=30,b=29
    @Test
    public void test05() throws AWTException {
        RobotEx robotEx = new RobotEx();
        double d1 = robotEx.distance(WoodWorker.sprintColor61, WoodWorker.sprintColor64);
        double d2 = robotEx.distance(WoodWorker.sprintColor62, WoodWorker.sprintColor64);
        double d3 = robotEx.distance(WoodWorker.sprintColor63, WoodWorker.sprintColor64);
        double d4 = robotEx.distance(new Color(90,155,70), WoodWorker.sprintColor64);
        double d5 = robotEx.distance(new Color(70,160,70), WoodWorker.sprintColor64);
//        90, 155, 70

        System.out.println(d1);
        System.out.println(d2);
        System.out.println(d3);
        System.out.println(d4);
        System.out.println(d5);
//0.7368584931331765
//0.5750282141003284
//0.5282340109399876
//0.08392522856250037
//0.11978449756068922

    }
     @Test
      public void test011() throws AWTException, InterruptedException {
         RobotEx robotEx = new RobotEx();
         TinyEggPrinter tp = new TinyEggPrinter(robotEx);
         TimeUnit.SECONDS.sleep(4);
         for (int i = 0; i <50 ; i++) {

             tp.dailyWar();
         }

      }


}
